‹#›
Autodesk Inventor 定制开发在线培训 2010
9.事件处理:
•VB6 类型
•
•
§
§
§
•.NET 类型
Private WithEvents userInterfaceEvtes As UserInterfaceEvents
Sub test()
Set userinterfaceevts = ThisApplication.UserInterfaceManager.UserInterfaceEvents
End Sub
Private Sub userInterfaceEvtes_OnResetCommandBars(ByVal CommandBars As ObjectsEnumerator, ByVal Context As NameValueMap)
End Sub
Private m_userInterfaceEvents As UserInterfaceEvents
AddHandler m_userInterfaceEvents.OnResetCommandBars, AddressOf _ Me.UserInterfaceEvents_OnResetCommandBars
Public Sub UserInterfaceEvents_OnResetCommandBars(ByVal commandBars As ObjectsEnumerator, ByVal context As NameValueMap)
End Sub
•VB 和 VB.Net 不同之处（续）
•

| In case of VB.NET you can use the VB6 way of event handling by using the WithEvents keyword of the object or can use the AddHandler function which subscribe only for a specific event of an object. And this latter is the .NET way of handling events.